def magic(number):
    number_2 = number
    while (number_2 !=1 and number <= 1_000_000_000):
        number = number*number_2
        number_2 = int(str(number)[0])
    return number

print(magic(2))
    